<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */
echo '<h2>Nejnovější komentáře</h2><ul class="list1">';
$query = $GLOBALS['db']->query("SELECT id, article_id, text FROM {prefix}comments ORDER BY date DESC LIMIT 10");
while($data = $query->fetch_array()){
    if(strlen($data['text']) > 30){
        $text = substr($data['text'], 0, 30) . ' ...';
	}else{
        $text = $data['text'];
	}
    
    $atitle = getTitleOfArticle($data['article_id']);
    $seo = new SeoUrl;
    $seo->Parse($atitle);
    
	echo '<li><a href="{url}index.php?q=content/'.$data['article_id'].'-'.$seo->result.'#comments">'.$text.'</a></li>';
}
echo '</ul>';
?>